package com.beiing.tianshuai.tianshuai.dongtai.presenter;

import com.beiing.tianshuai.tianshuai.dongtai.model.DynamicPublishModel;
import com.beiing.tianshuai.tianshuai.dongtai.model.DynamicPublishModelImpl;
import com.beiing.tianshuai.tianshuai.dongtai.view.DynamicPublishActivityViewImpl;
import com.beiing.tianshuai.tianshuai.entity.DynamicPublishBean;
import com.beiing.tianshuai.tianshuai.entity.DynamicPublishImageBean;

import java.util.List;

/**
 * 发布活动主持人
 * @author Administrator
 */
public class DynamicPublishPresenter implements DynamicPublishPresenterImpl,
        DynamicPublishModel.DynamicPublishImageDataResponseListener,
        DynamicPublishModel.DynamicPublishTextDataResponseListener {

    private DynamicPublishActivityViewImpl mView;
    private DynamicPublishModelImpl mModel;

    public DynamicPublishPresenter(DynamicPublishActivityViewImpl view) {
        mView = view;
        mModel = new DynamicPublishModel(this,this);
    }
    @Override
    public void postDynamicPublishText(String id, String content, String registrationId, String type) {
        mView.showProgress();
        mModel.postDynamicPublishText(id,content,registrationId,type);
    }

    @Override
    public void postDynamicPublishImage(String dId, List<String> imgPaths) {
        mView.showProgress();
        mModel.postDynamicPublishImage(dId,imgPaths);
    }

    @Override
    public void onGetDetailTextSuccess(DynamicPublishBean bean) {
        mView.hideProgress();
        mView.postDynamicPublishTextSuccess(bean);
    }

    @Override
    public void onGetDetailTextError(Throwable throwable) {
        mView.hideProgress();
        mView.postDynamicPublishTextError(throwable);
    }

    @Override
    public void onGetDetailImageSuccess(DynamicPublishImageBean bean) {
        mView.hideProgress();
        mView.postDynamicPublishImageSuccess(bean);
    }

    @Override
    public void onGetDetailImageError(Throwable throwable) {
        mView.hideProgress();
        mView.postDynamicPublishImageError(throwable);
    }
}
